<template>
  <div id="app">
    <input type="text"  />
    <button @click='fn' v-color='color1'>按钮</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      flag: false,
      color1:"red"
    }
  },
  computed: {},
  methods: {
   fn(){
   (this.color1==="red")?this.color1='green':this.color1='red'
   }
  },
 
}
</script>

<style></style>
